var reverseList = function(head) {
    let pre=null,cur=head,temp=null
    while(cur){
        temp=cur.next
        cur.next=pre
        pre=cur
        cur=temp
        
    }
    return pre
}